package com.meme.io.helper;

public class CodeFileWriter_ActionScript extends CodeFileWriter
{
	final static int IndentsSpaces = 3;
	
	public CodeFileWriter_ActionScript (String filename) throws Exception
	{
		super (filename, "as");
	}
	
	@Override
    public void writePackageHead (String packageName) throws Exception
	{
		writeTextLine ("package " + (packageName == null ? "" : packageName));
		writeTextLine ("{");
	   	incIndents ();
	}

	@Override
    public void writePackageTail (String packageName) throws Exception
	{
    	decIndents ();
    	writeTextLine ("}");
	}

	@Override
    public void writeClassHead (String className) throws Exception
	{
     	writeTextLine ("public class " + className);
    	writeTextLine ("{");
    	incIndents ();
	}

	@Override
    public void writeClassTail (String className) throws Exception
	{
    	decIndents ();
        writeTextLine ("}");
	}
    
	@Override
	public void writeAssignment (String varName, String varType, String varValue, boolean bFinal, boolean bStatic) throws Exception
	{
		if (bStatic)
			writeText ("static ");
		
		if (bFinal)
			writeText ("const ");
		else
			writeText ("var ");
		
		writeText (varName);
		writeText (" : ");
		writeText (varType);
		writeText (" = ");
		writeText (varValue);
		writeText (";");
	}
	
	
	@Override
	String getBooleanString ()
	{
		return "Boolean";
	}
	
	@Override
	String getIntString ()
	{
		return "int";
	}
	
	@Override
	String getFloatString ()
	{
		return "Number";
	}
	
	@Override
	String getStringString ()
	{
		return "String";
	}
	
	
	

}
